
/*
 * GET users listing.
 */

exports.list = function(req, res){
  res.send("respond with a resource");
};

//登陆方法 陈冰 2014-09-19
exports.login=function(req, res){
    //读取数据库值 chenbing
   // debugger;
    var db = require('./MySQL.js');
    var sql=" select * from sys_user where login_name='"+req.params.username +"' ";
    console.log(sql);
   var rows=db.select(sql);
    if(rows!=undefined)
    {
        //登陆验证
        if ( req.params.password == rows[0].password) {
            res.json({ state: true, msg: "登陆成功" });
        }
        else
            res.json({ state: false, msg: "用户密码错误！" });
    }
    else{
    res.json({ state: false, msg: "用户名未找到！" });

    }
};


//读取数据库值 chenbing
// debugger;
var db = require('./MySQL.js');
var sql=" select * from sys_user where login_name='admin' ";
console.log(sql);
var rows=db.select(sql);


